package cn.itcast.classSM.domain;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

@Entity
@Table(name="T_CHECK_MESSAGE")
//基本检查信息表
public class CheckMessage {
	
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Column(name = "CM_CMID") 
	private Integer cmid; //班级ID
	@Column(name = "CM_POSTED_TIME")
	@Temporal(TemporalType.DATE)
	private Date checkTime; //检查时间
	
	@ManyToOne
	@JoinColumn(name = "C_CM_USER")
	private User cmuser; //检查老师
		
	@OneToMany(mappedBy = "mcmCheckMessage")
	private Set<MainCheckMessage> mainCheckMessages  =new HashSet<MainCheckMessage>(); //主要查班信息
	
	public Set<MainCheckMessage> getMainCheckMessages() {
		return mainCheckMessages;
	}
	public void setMainCheckMessages(Set<MainCheckMessage> mainCheckMessages) {
		this.mainCheckMessages = mainCheckMessages;
	}
	public Integer getCmid() {
		return cmid;
	}
	public void setCmid(Integer cmid) {
		this.cmid = cmid;
	}
	public Date getCheckTime() {
		return checkTime;
	}
	public void setCheckTime(Date checkTime) {
		this.checkTime = checkTime;
	}
	public User getCmuser() {
		return cmuser;
	}
	public void setCmuser(User cmuser) {
		this.cmuser = cmuser;
	}

	@Override
	public String toString() {
		return "CheckMessage [cmid=" + cmid + ", checkTime=" + checkTime + ", cmuser=" + cmuser + ", mainCheckMessages="
				+ mainCheckMessages + "]";
	}	
}
